<?php
if (DOCUMENT_PASS!==hash('md5',get_config('passport'))){
	return_error('非法外部调用','-1',$_COOKIE['theme']);
	exit();
}
abstract class base_control{
	private $data=array();
	private $file='';
	public $json;
	function __construct(){
		$this->json=new json();
	}
	
	protected function assign($name,&$value){
		$this->data[$name]=$value;
	}
	
	protected function assign_del($name){
		unset($this->data[$name]);
	}
	
	protected function assign_app($name,&$value){
		if (is_array($this->data[$name])) {
			$this->data[$name][]=$value;
		}else if(!empty($this->data[$name])){
			$tmp=$this->data[$name];
			$this->data[$name]=array();
			$this->data[$name][]=$tmp;
			$this->data[$name][]=$value;
		}else{
			$this->assign($name,&$value);
		}
	}
	
	function get_data(){
		if (count($this->data)>0) {
			return $this->data;
		}
		return false;
	}
	/**
	 * 设置模版文件
	 * @param $name 文件路径
	 * @return unknown_type
	 */
	protected function assign_file($name){
	    if(!empty($name)){
	        $this->file=$name;
	    }
	}
	/**
	 * @todo 返回设置的文件版板
	 * @return unknown_type
	 */
	public function get_file(){
	    return $this->file;
	}
}
?>